]> dgit.raspbian.org Git - gnome-shell.git/commit
screenShield: Use identity operator when matching for motion events
authorRay Strode <rstrode@redhat.com>
Thu, 8 Oct 2020 13:36:30 +0000 (09:36 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 8 Oct 2020 13:45:51 +0000 (09:45 -0400)
commit2b44fa893f990f0f611d4b9d60c171649ec5cfc8
tree3771af47157c917536994720e93d8b8522534b78
parent6ba3ca5f9548ba0a87a9e3ffa129716d0a062e1e
screenShield: Use identity operator when matching for motion events

The screen shield watches for motion events to know to display
the pointer when the user wiggles their mouse.

It checks for motion events by looking at the event type and
seeing if it is of type `Clutter.EventType.MOTION`.  To do this
comparison it uses the equality operator (==).  Using the equality
operator isn't considered best practice, because it can returns true
when comparing disparate types, if those types happen to be equivalent
after coersion.

From a code resiliance point of view, it's better to use the
identity operator (===), which requires both sides of the comparison
to be of the same type.

As a policy, any legacy code that gets changed or moved should be
switched away from the equality operator to the identity operator, if
appropriate.

This commit makes that change as prep work for a fix to that part of
the code.

https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1459
js/ui/screenShield.js